Skip to content

fix: nested transformer request scope leakage#10281

Merged
michalsn merged 2 commits into
codeigniter4:developfrom
michalsn:fix/transformer-nested-state-leakage
Jun 7, 2026
Merged

fix: nested transformer request scope leakage#10281
michalsn merged 2 commits into
codeigniter4:developfrom
michalsn:fix/transformer-nested-state-leakage

Conversation

@michalsn

@michalsn michalsn commented Jun 5, 2026

Copy link
Copy Markdown
Member

Description
This PR fixes a bug where nested transformers created inside include*() methods could inherit the root request's fields and include query parameters.

Bare nested transformers now skip the root request scope, while root transformers and explicitly passed requests keep their existing behavior.

Ref: #10278

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 5, 2026

@datamweb datamweb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an elegant bug fix with excellent foresight. Thanks!

throw ApiException::forMissingInclude($include);
self::$depth++;

try {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really liked the use of try block!

@michalsn michalsn requested a review from paulbalandan June 6, 2026 11:11
@michalsn michalsn merged commit 167b544 into codeigniter4:develop Jun 7, 2026
91 of 92 checks passed
@michalsn

michalsn commented Jun 7, 2026

Copy link
Copy Markdown
Member Author

Thanks everyone for the review!

gr8man pushed a commit to gr8man/CodeIgniter4 that referenced this pull request Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants